home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / source / dflt19 / dflat.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-05-19  |  20.3 KB  |  481 lines

  1. /* ------------- dflat.h ----------- */
  2. #ifndef DFLAT_H
  3. #define DFLAT_H
  4.  
  5. #ifdef BUILD_FULL_DFLAT
  6. #define INCLUDE_MULTI_WINDOWS
  7. #define INCLUDE_LOGGING
  8. #define INCLUDE_SHELLDOS
  9. #define INCLUDE_WINDOWOPTIONS
  10. #define INCLUDE_PICTUREBOX
  11. #define INCLUDE_MINIMIZE
  12. #define INCLUDE_MAXIMIZE
  13. #define INCLUDE_RESTORE
  14. #define INCLUDE_EXTENDEDSELECTIONS
  15. #endif
  16.  
  17. #include <stdio.h>
  18. #include <string.h>
  19. #include <stdlib.h>
  20. #include <dos.h>
  21. #include <process.h>
  22. #include <conio.h>
  23. #include <bios.h>
  24. #include <ctype.h>
  25. #include <io.h>
  26. #include <sys\types.h>
  27. #include <sys\stat.h>
  28. #include <time.h>
  29. #include <setjmp.h>
  30.  
  31. #ifndef VERSION
  32. #define VERSION "Version 19"
  33. #endif
  34.  
  35. void *DFcalloc(size_t, size_t);
  36. void *DFmalloc(size_t);
  37. void *DFrealloc(void *, size_t);
  38.  
  39. typedef enum {FALSE, TRUE} BOOL;
  40.  
  41. #define MAXMESSAGES 50
  42. #define DELAYTICKS 1
  43. #define FIRSTDELAY 7
  44. #define DOUBLETICKS 5
  45.  
  46. #define MAXTEXTLEN 65000U /* maximum text buffer            */
  47. #define EDITLEN     1024  /* starting length for multiliner */
  48. #define ENTRYLEN     256  /* starting length for one-liner  */
  49. #define GROWLENGTH    64  /* buffers grow by this much      */
  50.  
  51. #include "system.h"
  52. #include "config.h"
  53. #include "rect.h"
  54. #include "menu.h"
  55. #include "keys.h"
  56. #include "commands.h"
  57. #include "dialbox.h"
  58. #include "helpbox.h"
  59.  
  60. /* ------ integer type for message parameters ----- */
  61. typedef long PARAM;
  62.  
  63. enum Condition     {
  64.     ISRESTORED, ISMINIMIZED, ISMAXIMIZED, ISCLOSING
  65. };
  66.  
  67. typedef struct window {
  68.     CLASS class;           /* window class                  */
  69.     char *title;           /* window title                  */
  70.     int (*wndproc)
  71.         (struct window *, enum messages, PARAM, PARAM);
  72.     /* ----------------- window colors -------------------- */
  73.     char WindowColors[4][2];
  74.     /* ---------------- window dimensions ----------------- */
  75.     RECT rc;               /* window coordinates
  76.                                             (0/0 to 79/24)  */
  77.     int ht, wd;            /* window height and width       */
  78.     RECT RestoredRC;       /* restored condition rect       */
  79.     /* -------------- linked list pointers ---------------- */
  80.     struct window *parent; /* parent window                 */
  81.     struct window *firstchild;  /* first child this parent  */
  82.     struct window *lastchild;   /* last child this parent   */
  83.     struct window *nextsibling; /* next sibling             */
  84.     struct window *prevsibling; /* previous sibling         */
  85.  
  86.     struct window *childfocus;    /* child that ha(s/d) focus */
  87.     int attrib;                 /* Window attributes        */
  88.     char *videosave;            /* video save buffer        */
  89.     enum Condition condition;   /* Restored, Maximized,
  90.                                    Minimized, Closing       */
  91.     enum Condition oldcondition;/* previous condition       */
  92.     BOOL wasCleared;
  93.     int restored_attrib;        /* attributes when restored */
  94.     void *extension;      /* menus, dialogs, documents, etc */
  95.     struct window *PrevMouse;   /* previous mouse capture   */
  96.     struct window *PrevKeyboard;/* previous keyboard capture*/
  97.     struct window *PrevClock;   /* previous clock capture   */
  98.     struct window *MenuBarWnd;/* menu bar                   */
  99.     struct window *StatusBar; /* status bar                 */
  100.     int isHelping;        /* > 0 when help is being displayed */
  101.     /* ----------------- text box fields ------------------ */
  102.     int wlines;     /* number of lines of text              */
  103.     int wtop;       /* text line that is on the top display */
  104.     unsigned char *text; /* window text                     */
  105.     unsigned int textlen;  /* text length                   */
  106.     int wleft;      /* left position in window viewport     */
  107.     int textwidth;  /* width of longest line in textbox     */
  108.     int BlkBegLine; /* beginning line of marked block       */
  109.     int BlkBegCol;  /* beginning column of marked block     */
  110.     int BlkEndLine; /* ending line of marked block          */
  111.     int BlkEndCol;  /* ending column of marked block        */
  112.     int HScrollBox; /* position of horizontal scroll box    */
  113.     int VScrollBox; /* position of vertical scroll box      */
  114.     unsigned int *TextPointers; /* -> list of line offsets    */
  115.     /* ----------------- list box fields ------------------ */
  116.     int selection;  /* current selection                    */
  117.     BOOL AddMode;   /* adding extended selections mode      */
  118.     int AnchorPoint;/* anchor point for extended selections */
  119.     int SelectCount;/* count of selected items              */
  120.     /* ----------------- edit box fields ------------------ */
  121.     int CurrCol;      /* Current column                     */
  122.     int CurrLine;     /* Current line                       */
  123.     int WndRow;       /* Current window row                 */
  124.     BOOL TextChanged; /* TRUE if text has changed           */
  125.     unsigned char *DeletedText; /* for undo                 */
  126.     unsigned DeletedLength; /* Length of deleted field      */
  127.     BOOL InsertMode;   /* TRUE or FALSE for text insert     */
  128.     BOOL WordWrapMode; /* TRUE or FALSE for word wrap       */
  129.     unsigned int MaxTextLength; /* maximum text length      */
  130.     /* ---------------- dialog box fields ----------------- */
  131.     int ReturnCode;        /* return code from a dialog box */
  132.     BOOL Modal;               /* True if a modeless dialog box */
  133.     CTLWINDOW *ct;           /* control structure             */
  134.     struct window *dfocus; /* control window that has focus */
  135.     /* -------------- popdownmenu fields ------------------ */
  136.     MENU *mnu;        /* points to menu structure             */
  137.     MBAR *holdmenu; /* previous active menu                 */
  138.     struct window *oldFocus;
  139.     /* -------------- status bar fields ------------------- */
  140.     BOOL TimePosted; /* True if time has been posted        */
  141. #ifdef INCLUDE_PICTUREBOX
  142.     /* ------------- picture box fields ------------------- */
  143.     int VectorCount;  /* number of vectors in vector list   */
  144.     void *VectorList; /* list of picture box vectors        */
  145. #endif
  146. } * WINDOW;
  147.  
  148. #include "classdef.h"
  149. #include "video.h"
  150.  
  151. void LogMessages (WINDOW, MESSAGE, PARAM, PARAM);
  152. void MessageLog(WINDOW);
  153. /* ------- window methods ----------- */
  154. #define ICONHEIGHT 3
  155. #define ICONWIDTH  10
  156. #define WindowHeight(w)      ((w)->ht)
  157. #define WindowWidth(w)       ((w)->wd)
  158. #define BorderAdj(w)         (TestAttribute(w,HASBORDER)?1:0)
  159. #define BottomBorderAdj(w)   (TestAttribute(w,HASSTATUSBAR)?1:BorderAdj(w))
  160. #define TopBorderAdj(w)      ((TestAttribute(w,HASTITLEBAR) &&   \
  161.                               TestAttribute(w,HASMENUBAR)) ?  \
  162.                               2 : (TestAttribute(w,HASTITLEBAR | \
  163.                               HASMENUBAR | HASBORDER) ? 1 : 0))
  164. #define ClientWidth(w)       (WindowWidth(w)-BorderAdj(w)*2)
  165. #define ClientHeight(w)      (WindowHeight(w)-TopBorderAdj(w)-\
  166.                               BottomBorderAdj(w))
  167. #define WindowRect(w)        ((w)->rc)
  168. #define GetTop(w)            (RectTop(WindowRect(w)))
  169. #define GetBottom(w)         (RectBottom(WindowRect(w)))
  170. #define GetLeft(w)           (RectLeft(WindowRect(w)))
  171. #define GetRight(w)          (RectRight(WindowRect(w)))
  172. #define GetClientTop(w)      (GetTop(w)+TopBorderAdj(w))
  173. #define GetClientBottom(w)   (GetBottom(w)-BottomBorderAdj(w))
  174. #define GetClientLeft(w)     (GetLeft(w)+BorderAdj(w))
  175. #define GetClientRight(w)    (GetRight(w)-BorderAdj(w))
  176. #define GetTitle(w)          ((w)->title)
  177. #define GetParent(w)         ((w)->parent)
  178. #define FirstWindow(w)       ((w)->firstchild)
  179. #define LastWindow(w)        ((w)->lastchild)
  180. #define NextWindow(w)        ((w)->nextsibling)
  181. #define PrevWindow(w)        ((w)->prevsibling)
  182. #define GetClass(w)          ((w)->class)
  183. #define GetAttribute(w)      ((w)->attrib)
  184. #define AddAttribute(w,a)    (GetAttribute(w) |= a)
  185. #define ClearAttribute(w,a)  (GetAttribute(w) &= ~(a))
  186. #define TestAttribute(w,a)   (GetAttribute(w) & (a))
  187. #define isHidden(w)          (!(GetAttribute(w) & VISIBLE))
  188. #define SetVisible(w)        (GetAttribute(w) |= VISIBLE)
  189. #define ClearVisible(w)      (GetAttribute(w) &= ~VISIBLE)
  190. #define gotoxy(w,x,y) cursor(w->rc.lf+(x)+1,w->rc.tp+(y)+1)
  191. BOOL isVisible(WINDOW);
  192. WINDOW CreateWindow(CLASS,char *,int,int,int,int,void*,WINDOW,
  193.        int (*)(struct window *,enum messages,PARAM,PARAM),int);
  194. void AddTitle(WINDOW, char *);
  195. void InsertTitle(WINDOW, char *);
  196. void DisplayTitle(WINDOW, RECT *);
  197. void RepaintBorder(WINDOW, RECT *);
  198. void PaintShadow(WINDOW);
  199. void ClearWindow(WINDOW, RECT *, int);
  200. void writeline(WINDOW, char *, int, int, BOOL);
  201. void InitWindowColors(WINDOW);
  202.  
  203. void SetNextFocus(void);
  204. void SetPrevFocus(void);
  205. void RemoveWindow(WINDOW);
  206. void AppendWindow(WINDOW);
  207. void ReFocus(WINDOW);
  208. void SkipApplicationControls(void);
  209.  
  210. BOOL CharInView(WINDOW, int, int);
  211. void CreatePath(char *, char *, int, int);
  212. #define SwapVideoBuffer(wnd, ish, fh) swapvideo(wnd, wnd->videosave, ish, fh)
  213. int LineLength(char *);
  214. RECT AdjustRectangle(WINDOW, RECT);
  215. BOOL isDerivedFrom(WINDOW, CLASS);
  216. WINDOW GetAncestor(WINDOW);
  217. void PutWindowChar(WINDOW,int,int,int);
  218. void PutWindowLine(WINDOW, void *,int,int);
  219. #define BaseWndProc(class,wnd,msg,p1,p2)    \
  220.     (*classdefs[(classdefs[class].base)].wndproc)(wnd,msg,p1,p2)
  221. #define DefaultWndProc(wnd,msg,p1,p2)         \
  222.     (classdefs[wnd->class].wndproc == NULL) ? \
  223.     BaseWndProc(wnd->class,wnd,msg,p1,p2) :      \
  224.     (*classdefs[wnd->class].wndproc)(wnd,msg,p1,p2)
  225. struct LinkedList    {
  226.     WINDOW FirstWindow;
  227.     WINDOW LastWindow;
  228. };
  229. extern WINDOW ApplicationWindow;
  230. extern WINDOW inFocus;
  231. extern WINDOW CaptureMouse;
  232. extern WINDOW CaptureKeyboard;
  233. extern int foreground, background;
  234. extern BOOL WindowMoving;
  235. extern BOOL WindowSizing;
  236. extern BOOL VSliding;
  237. extern BOOL HSliding;
  238. extern char DFlatApplication[];
  239. extern char *Clipboard;
  240. extern unsigned ClipboardLength;
  241. extern BOOL ClipString;
  242. /* --------- space between menubar labels --------- */
  243. #define MSPACE 2
  244. /* --------------- border characters ------------- */
  245. #define FOCUS_NW      (unsigned char) '\xc9'
  246. #define FOCUS_NE      (unsigned char) '\xbb'
  247. #define FOCUS_SE      (unsigned char) '\xbc'
  248. #define FOCUS_SW      (unsigned char) '\xc8'
  249. #define FOCUS_SIDE    (unsigned char) '\xba'
  250. #define FOCUS_LINE    (unsigned char) '\xcd'
  251. #define NW            (unsigned char) '\xda'
  252. #define NE            (unsigned char) '\xbf'
  253. #define SE            (unsigned char) '\xd9'
  254. #define SW            (unsigned char) '\xc0'
  255. #define SIDE          (unsigned char) '\xb3'
  256. #define LINE          (unsigned char) '\xc4'
  257. #define LEDGE         (unsigned char) '\xc3'
  258. #define REDGE         (unsigned char) '\xb4'
  259. /* ------------- scroll bar characters ------------ */
  260. #define UPSCROLLBOX    (unsigned char) '\x1e'
  261. #define DOWNSCROLLBOX  (unsigned char) '\x1f'
  262. #define LEFTSCROLLBOX  (unsigned char) '\x11'
  263. #define RIGHTSCROLLBOX (unsigned char) '\x10'
  264. #define SCROLLBARCHAR  (unsigned char) 176 
  265. #define SCROLLBOXCHAR  (unsigned char) 178
  266. /* ------------------ menu characters --------------------- */
  267. #define CHECKMARK      (unsigned char) (SCREENHEIGHT==25?251:4)
  268. #define CASCADEPOINTER (unsigned char) '\x10'
  269. /* ----------------- title bar characters ----------------- */
  270. #define CONTROLBOXCHAR (unsigned char) '\xf0'
  271. #define MAXPOINTER     24      /* maximize token            */
  272. #define MINPOINTER     25      /* minimize token            */
  273. #define RESTOREPOINTER 18      /* restore token             */
  274. /* --------------- text control characters ---------------- */
  275. #define APPLCHAR     (unsigned char) 176 /* fills application window */
  276. #define SHORTCUTCHAR '~'    /* prefix: shortcut key display */
  277. #define CHANGECOLOR  (unsigned char) 174 /* prefix to change colors  */
  278. #define RESETCOLOR   (unsigned char) 175 /* reset colors to default  */
  279. #define LISTSELECTOR   4    /* selected list box entry      */
  280. /* --------- message prototypes ----------- */
  281. BOOL init_messages(void);
  282. void PostMessage(WINDOW, MESSAGE, PARAM, PARAM);
  283. int SendMessage(WINDOW, MESSAGE, PARAM, PARAM);
  284. BOOL dispatch_message(void);
  285. void handshake(void);
  286. int TestCriticalError(void);
  287. /* ---- standard window message processing prototypes ----- */
  288. int ApplicationProc(WINDOW, MESSAGE, PARAM, PARAM);
  289. int NormalProc(WINDOW, MESSAGE, PARAM, PARAM);
  290. int TextBoxProc(WINDOW, MESSAGE, PARAM, PARAM);
  291. int ListBoxProc(WINDOW, MESSAGE, PARAM, PARAM);
  292. int EditBoxProc(WINDOW, MESSAGE, PARAM, PARAM);
  293. int EditorProc(WINDOW, MESSAGE, PARAM, PARAM);
  294. int PictureProc(WINDOW, MESSAGE, PARAM, PARAM);
  295. int MenuBarProc(WINDOW, MESSAGE, PARAM, PARAM);
  296. int PopDownProc(WINDOW, MESSAGE, PARAM, PARAM);
  297. int ButtonProc(WINDOW, MESSAGE, PARAM, PARAM);
  298. int ComboProc(WINDOW, MESSAGE, PARAM, PARAM);
  299. int TextProc(WINDOW, MESSAGE, PARAM, PARAM);
  300. int RadioButtonProc(WINDOW, MESSAGE, PARAM, PARAM);
  301. int CheckBoxProc(WINDOW, MESSAGE, PARAM, PARAM);
  302. int SpinButtonProc(WINDOW, MESSAGE, PARAM, PARAM);
  303. int BoxProc(WINDOW, MESSAGE, PARAM, PARAM);
  304. int DialogProc(WINDOW, MESSAGE, PARAM, PARAM);
  305. int SystemMenuProc(WINDOW, MESSAGE, PARAM, PARAM);
  306. int HelpBoxProc(WINDOW, MESSAGE, PARAM, PARAM);
  307. int MessageBoxProc(WINDOW, MESSAGE, PARAM, PARAM);
  308. int CancelBoxProc(WINDOW, MESSAGE, PARAM, PARAM);
  309. int ErrorBoxProc(WINDOW, MESSAGE, PARAM, PARAM);
  310. int YesNoBoxProc(WINDOW, MESSAGE, PARAM, PARAM);
  311. int StatusBarProc(WINDOW, MESSAGE, PARAM, PARAM);
  312. int WatchIconProc(WINDOW, MESSAGE, PARAM, PARAM);
  313. /* ------------- normal box prototypes ------------- */
  314. void SetStandardColor(WINDOW);
  315. void SetReverseColor(WINDOW);
  316. BOOL isAncestor(WINDOW, WINDOW);
  317. #define HitControlBox(wnd, p1, p2)     \
  318.      (TestAttribute(wnd, CONTROLBOX) && \
  319.      p1 == 2 && p2 == 0)
  320. #define WndForeground(wnd)         \
  321.     (wnd->WindowColors [STD_COLOR] [FG])
  322. #define WndBackground(wnd)         \
  323.     (wnd->WindowColors [STD_COLOR] [BG])
  324. #define FrameForeground(wnd)     \
  325.     (wnd->WindowColors [FRAME_COLOR] [FG])
  326. #define FrameBackground(wnd)     \
  327.     (wnd->WindowColors [FRAME_COLOR] [BG])
  328. #define SelectForeground(wnd)     \
  329.     (wnd->WindowColors [SELECT_COLOR] [FG])
  330. #define SelectBackground(wnd)     \
  331.     (wnd->WindowColors [SELECT_COLOR] [BG])
  332. #define HighlightForeground(wnd)     \
  333.     (wnd->WindowColors [HILITE_COLOR] [FG])
  334. #define HighlightBackground(wnd)     \
  335.     (wnd->WindowColors [HILITE_COLOR] [BG])
  336. #define WindowClientColor(wnd, fg, bg)     \
  337.         WndForeground(wnd) = fg, WndBackground(wnd) = bg
  338. #define WindowReverseColor(wnd, fg, bg) \
  339.         SelectForeground(wnd) = fg, SelectBackground(wnd) = bg
  340. #define WindowFrameColor(wnd, fg, bg) \
  341.         FrameForeground(wnd) = fg, FrameBackground(wnd) = bg
  342. #define WindowHighlightColor(wnd, fg, bg) \
  343.         HighlightForeground(wnd) = fg, HighlightBackground(wnd) = bg
  344. /* -------- text box prototypes ---------- */
  345. #define TextLine(wnd, sel) \
  346.       (wnd->text + *((wnd->TextPointers) + sel))
  347. void WriteTextLine(WINDOW, RECT *, int, BOOL);
  348. #define TextBlockMarked(wnd) (  wnd->BlkBegLine ||    \
  349.                                 wnd->BlkEndLine ||    \
  350.                                 wnd->BlkBegCol  ||    \
  351.                                 wnd->BlkEndCol)
  352. void MarkTextBlock(WINDOW, int, int, int, int);
  353. #define ClearTextBlock(wnd) wnd->BlkBegLine = wnd->BlkEndLine =  \
  354.                         wnd->BlkBegCol  = wnd->BlkEndCol = 0;
  355. #define TextBlockBegin(wnd) (TextLine(wnd,wnd->BlkBegLine)+wnd->BlkBegCol)
  356. #define TextBlockEnd(wnd)   (TextLine(wnd,wnd->BlkEndLine)+wnd->BlkEndCol)
  357. #define GetText(w)        ((w)->text)
  358. #define GetTextLines(w)   ((w)->wlines)
  359. void ClearTextPointers(WINDOW);
  360. void BuildTextPointers(WINDOW);
  361. int TextLineNumber(WINDOW, char *);
  362. /* ------------ Clipboard prototypes ------------- */
  363. void CopyTextToClipboard(char *);
  364. void CopyToClipboard(WINDOW);
  365. #define PasteFromClipboard(wnd) PasteText(wnd,Clipboard,ClipboardLength)
  366. BOOL PasteText(WINDOW, char *, unsigned);
  367. void ClearClipboard(void);
  368. /* --------- menu prototypes ---------- */
  369. int CopyCommand(unsigned char *, unsigned char *, int, int);
  370. void PrepFileMenu(void *, struct Menu *);
  371. void PrepEditMenu(void *, struct Menu *);
  372. void PrepSearchMenu(void *, struct Menu *);
  373. void PrepWindowMenu(void *, struct Menu *);
  374. void BuildSystemMenu(WINDOW);
  375. BOOL isActive(MBAR *, int);
  376. char *GetCommandText(MBAR *, int);
  377. BOOL isCascadedCommand(MBAR *,int);
  378. void ActivateCommand(MBAR *,int);
  379. void DeactivateCommand(MBAR *,int);
  380. BOOL GetCommandToggle(MBAR *,int);
  381. void SetCommandToggle(MBAR *,int);
  382. void ClearCommandToggle(MBAR *,int);
  383. void InvertCommandToggle(MBAR *,int);
  384. int BarSelection(int);
  385. /* ------------- list box prototypes -------------- */
  386. BOOL ItemSelected(WINDOW, int);
  387. /* ------------- edit box prototypes ----------- */
  388. #define CurrChar (TextLine(wnd, wnd->CurrLine)+wnd->CurrCol)
  389. #define WndCol   (wnd->CurrCol-wnd->wleft)
  390. #define isMultiLine(wnd) TestAttribute(wnd, MULTILINE)
  391. void SearchText(WINDOW);
  392. void ReplaceText(WINDOW);
  393. void SearchNext(WINDOW);
  394. /* ------------- editor prototypes ----------- */
  395. void CollapseTabs(WINDOW wnd);
  396. void ExpandTabs(WINDOW wnd);
  397. /* --------- message box prototypes -------- */
  398. WINDOW SliderBox(int, char *, char *);
  399. BOOL InputBox(WINDOW, char *, char *, char *, int, int);
  400. BOOL GenericMessage(WINDOW, char *, char *, int,
  401.     int (*)(struct window *, enum messages, PARAM, PARAM),
  402.     char *, char *, int, int, int);
  403. #define TestErrorMessage(msg)    \
  404.     GenericMessage(NULL, "Error", msg, 2, ErrorBoxProc,      \
  405.         Ok, Cancel, ID_OK, ID_CANCEL, TRUE)
  406. #define ErrorMessage(msg) \
  407.     GenericMessage(NULL, "Error", msg, 1, ErrorBoxProc,   \
  408.         Ok, NULL, ID_OK, 0, TRUE)
  409. #define MessageBox(ttl, msg) \
  410.     GenericMessage(NULL, ttl, msg, 1, MessageBoxProc, \
  411.         Ok, NULL, ID_OK, 0, TRUE)
  412. #define YesNoBox(msg)    \
  413.     GenericMessage(NULL, NULL, msg, 2, YesNoBoxProc,   \
  414.         Yes, No, ID_OK, ID_CANCEL, TRUE)
  415. #define CancelBox(wnd, msg) \
  416.     GenericMessage(wnd, "Wait...", msg, 1, CancelBoxProc, \
  417.         Cancel, NULL, ID_CANCEL, 0, FALSE)
  418. void CloseCancelBox(void);
  419. WINDOW MomentaryMessage(char *);
  420. int MsgHeight(char *);
  421. int MsgWidth(char *);
  422.  
  423. /* ------------- dialog box prototypes -------------- */
  424. BOOL DialogBox(WINDOW, DBOX *, BOOL,
  425.        int (*)(struct window *, enum messages, PARAM, PARAM));
  426. void ClearDialogBoxes(void);
  427. BOOL OpenFileDialogBox(char *, char *);
  428. BOOL SaveAsDialogBox(char *, char *, char *);
  429. void GetDlgListText(WINDOW, char *, enum commands);
  430. BOOL RadioButtonSetting(DBOX *, enum commands);
  431. void PushRadioButton(DBOX *, enum commands);
  432. void PutItemText(WINDOW, enum commands, char *);
  433. void PutComboListText(WINDOW, enum commands, char *);
  434. void GetItemText(WINDOW, enum commands, char *, int);
  435. char *GetDlgTextString(DBOX *, enum commands, CLASS);
  436. void SetDlgTextString(DBOX *, enum commands, char *, CLASS);
  437. BOOL CheckBoxSetting(DBOX *, enum commands);
  438. CTLWINDOW *FindCommand(DBOX *, enum commands, int);
  439. WINDOW ControlWindow(DBOX *, enum commands);
  440. void SetScrollBars(WINDOW);
  441. void SetRadioButton(DBOX *, CTLWINDOW *);
  442. void ControlSetting(DBOX *, enum commands, int, int);
  443. void SetFocusCursor(WINDOW);
  444.  
  445. #define GetControl(wnd)             (wnd->ct)
  446. #define GetDlgText(db, cmd)         GetDlgTextString(db, cmd, TEXT)
  447. #define GetDlgTextBox(db, cmd)      GetDlgTextString(db, cmd, TEXTBOX)
  448. #define GetEditBoxText(db, cmd)     GetDlgTextString(db, cmd, EDITBOX)
  449. #define GetComboBoxText(db, cmd)    GetDlgTextString(db, cmd, COMBOBOX)
  450. #define SetDlgText(db, cmd, s)      SetDlgTextString(db, cmd, s, TEXT)
  451. #define SetDlgTextBox(db, cmd, s)   SetDlgTextString(db, cmd, s, TEXTBOX)
  452. #define SetEditBoxText(db, cmd, s)  SetDlgTextString(db, cmd, s, EDITBOX)
  453. #define SetComboBoxText(db, cmd, s) SetDlgTextString(db, cmd, s, COMBOBOX)
  454. #define SetDlgTitle(db, ttl)        ((db)->dwnd.title = ttl)
  455. #define SetCheckBox(db, cmd)        ControlSetting(db, cmd, CHECKBOX, ON)
  456. #define ClearCheckBox(db, cmd)      ControlSetting(db, cmd, CHECKBOX, OFF)
  457. #define EnableButton(db, cmd)       ControlSetting(db, cmd, BUTTON, ON)
  458. #define DisableButton(db, cmd)      ControlSetting(db, cmd, BUTTON, OFF)
  459.  
  460. /* ---- types of vectors that can be in a picture box ------- */
  461. enum VectTypes {VECTOR, SOLIDBAR, HEAVYBAR, CROSSBAR, LIGHTBAR};
  462.  
  463. /* ------------- picture box prototypes ------------- */
  464. void DrawVector(WINDOW, int, int, int, int);
  465. void DrawBox(WINDOW, int, int, int, int);
  466. void DrawBar(WINDOW, enum VectTypes, int, int, int, int);
  467. WINDOW WatchIcon(void);
  468.  
  469. /* ------------- help box prototypes ------------- */
  470. void LoadHelpFile(char *);
  471. void UnLoadHelpFile(void);
  472. BOOL DisplayHelp(WINDOW, char *);
  473. char *HelpComment(char *);
  474.  
  475. extern char *ClassNames[];
  476.  
  477. void BuildFileName(char *path, const char *fn, const char *ext);
  478.  
  479. #endif
  480.  
  481.